From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue Mar 14 23:22:02 2006 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Tue Mar 14 23:22:02 2006 Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:02 2006 Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:02 2006 Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:02 2006 Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Tue Mar 14 23:22:02 2006 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx@mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:02 2006 Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Tue Mar 14 23:22:02 2006 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 14 23:22:02 2006 Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue Mar 14 23:22:02 2006 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue Mar 28 18:25:26 2006 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Tue Mar 28 18:25:27 2006 Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:27 2006 Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:27 2006 Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:27 2006 Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Tue Mar 28 18:25:27 2006 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx@mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:27 2006 Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Tue Mar 28 18:25:27 2006 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0001.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 18:25:27 2006 Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue Mar 28 18:25:27 2006 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue Mar 28 20:17:22 2006 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Tue Mar 28 20:17:22 2006 Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:22 2006 Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:22 2006 Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:22 2006 Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Tue Mar 28 20:17:22 2006 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx@mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:22 2006 Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Tue Mar 28 20:17:22 2006 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0002.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue Mar 28 20:17:22 2006 Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue Mar 28 20:17:22 2006 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0003.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0004.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0005.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0006.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0007.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0008.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0009.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0010.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0011.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0012.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0013.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0014.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0015.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0016.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0017.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0018.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0019.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0020.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0021.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0022.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0023.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0024.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0025.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0026.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0027.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0028.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0029.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0030.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0031.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0032.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0033.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0034.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0035.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0036.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0037.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0038.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0039.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0040.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0041.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0042.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0043.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0044.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0045.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0046.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0047.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0048.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0049.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0050.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0051.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0052.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0053.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0054.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0055.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0056.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0057.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0058.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0059.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0060.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0061.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0062.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0063.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0064.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0065.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0066.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0067.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0068.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0069.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0070.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0071.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0072.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0073.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0074.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0075.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0076.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0077.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0078.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0079.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0080.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0081.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0082.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0083.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0084.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0085.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0086.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0087.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0088.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0089.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0090.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0091.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0092.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0093.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0094.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0095.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0096.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0097.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0098.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0099.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0100.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0101.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0102.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0103.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0104.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0105.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0106.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0107.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0108.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0109.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0110.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0111.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0112.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0113.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0114.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0115.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0116.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0117.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0118.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0119.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0120.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0121.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0122.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0123.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0124.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0125.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0126.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0127.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0128.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0129.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0130.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0131.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0132.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0133.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0134.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0135.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0136.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0137.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0138.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0139.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0140.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0141.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0142.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0143.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0144.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0145.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0146.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0147.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0148.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0149.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0150.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0151.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0152.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0153.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0154.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0155.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0156.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0157.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0158.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0159.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0160.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0161.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0162.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0163.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0164.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0165.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0166.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0167.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0168.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0169.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0170.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0171.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0172.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0173.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0174.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0175.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0176.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0177.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0178.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0179.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0180.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0181.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0182.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0183.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0184.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0185.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0186.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0187.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0188.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0189.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0190.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0191.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0192.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0193.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0194.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0195.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0196.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0197.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0198.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0199.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0200.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0201.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0202.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0203.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0204.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0205.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0206.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0207.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0208.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0209.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0210.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0211.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0212.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0213.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0214.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0215.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0216.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0217.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0218.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0219.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0220.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0221.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0222.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0223.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0224.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0225.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0226.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0227.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0228.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0229.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0230.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0231.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0232.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0233.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0234.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0235.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0236.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0237.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0238.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0239.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0240.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0241.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0242.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0243.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0244.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0245.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0246.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0247.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0248.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0249.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0250.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0251.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0252.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0253.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0254.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0255.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0256.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0257.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0258.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0259.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0260.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0261.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0262.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0263.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0264.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0265.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0266.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0267.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0268.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0269.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0270.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0271.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0272.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0273.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0274.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0275.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0276.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0277.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0278.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0279.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0280.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0281.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0282.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0283.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0284.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0285.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0286.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0287.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0288.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0289.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0290.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0291.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0292.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0293.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0294.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0295.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0296.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0297.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0298.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0299.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0300.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0301.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0302.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0303.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0304.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0305.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0306.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0307.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0308.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0309.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0310.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0311.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0312.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0313.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0314.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0315.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0316.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0317.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0318.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0319.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0320.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0321.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0322.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0323.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0324.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0325.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0326.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0327.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0328.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0329.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0330.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0331.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0332.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0333.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0334.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0335.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0336.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0337.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0338.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0339.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0340.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0341.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0342.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0343.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0344.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0345.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0346.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0347.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0348.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0349.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0350.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0351.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0352.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0353.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0354.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0355.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0356.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0357.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0358.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0359.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0360.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0361.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0362.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0363.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0364.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0365.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0366.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0367.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0368.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0369.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0370.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0371.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0372.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0373.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0374.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0375.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0376.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0377.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0378.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0379.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0380.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0381.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0382.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0383.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0384.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0385.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0386.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0387.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0388.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0389.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0390.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0391.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0392.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug From d.tonhofer at m-plify.com Wed Sep 7 10:53:52 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 07 Sep 2005 18:53:52 +0200 Subject: [Rxtx] Additional note on the CommPort.close() deadlock Message-ID: <8254EA7AAB6B00B491BB9428@[192.168.1.7]> Hello, There might be a bullet point to add to the RXTX homepage in relation to the 'deadlock' problem that occurs under the following conditions: * Closing a port from an event listener results in a deadlock. * Closing a port without adding an event listener results in a deadlock. namely: * Closing a port on which there is an open InputStream that is being repeatedly read results in a deadlock. This may or may not technically be true, let me explain briefly: I had old code that I wanted to use with rxtx-2.1-CVS-20050120 on 64-bit machines when I stumbled upon the deadlock problem back in March . A quick fix - adding a dummy event listener on the port - did not help so I put the thing on hold (6 months ago!! ... time flies) This week I took it upon myself to make the thing work. Turns out that in the old code, I had a Java thread doing reads in a loop on the CommPort's InputStream. A timeout had been set on the CommPort using a REQUEST_ENABLE_RECEIVE_TIMEOUT command, so the thread really looped (as opposed to waiting indefinitely), like this: // get stream CommPort cp = cpi.open(getAppName(), getTimeout_ms()); InputStream is = cp.getInputStream(); // add a dummy listener (according to RXTX homepage) { gnu.io.SerialPortEventListener dummy = new gnu.io.SerialPortEventListener() { public void serialEvent(SerialPortEvent x) { // NOP } }; ((SerialPort) (cp)).addEventListener(dummy); } // loop for(;;) { logCat.debug("Loop top"); // blocking read: wait for a single byte or an interrupt on the InputStream int x = 0; try { logCat.debug("Calling blocking one-char read() on the input stream"); x = is.read(); } catch (InterruptedIOException exe) { // never ever happens } // ....process etc.... } To release everything, the old code called CommPort.close() in another thread, and InputStream.read() above would then throw an Exception, terminating the loop. I didn't bother to ever call InputStream.close(). This was no longer working in rxtx-2.1-CVS-20050120. The deadlock on CommPort.close() occurred, even with the 'dummy listener' attached to the port. Weirdly, even while CommPort.close() never returned, one would still see the above loop's 'loop top' messages. The (obvious) thing to try was to stop the loop before CommPort.close(), which was done with a "while (!isStopNow())" replacing the "for(;;)" - nothing fancy. After that change, CommPort.close() returned normally. I don't know why that would be but it seems that repeat calls to InputStream.read() also deadlocks the CommPort.close() - note that I do *not* close the InputStream when leaving the loop, I just leave it the stream alone. I don't know how this is possible or if I missed something, anyway it's a little heads-up. Btw... there aren't any messages in the mailing list archive after 2005-03-26 ???! Or am I smoking again? Best regards, -- David From bst_co at yahoo.com Thu Sep 8 09:18:38 2005 From: bst_co at yahoo.com (bst) Date: Thu, 8 Sep 2005 08:18:38 -0700 (PDT) Subject: [Rxtx] write(), flush() and CTS Message-ID: <20050908151839.4820.qmail@web50403.mail.yahoo.com> Hi, I have an application that sends data to a device. When the device drops CTS there are some bytes that go to the device. I think UART keeps sending the data from it's internal buffer. To prevent this I had to write the code that flushes the buffer after every byte. if(!serialPort.isCTS()) return "No CTS"; byte ba[] = data; int size = ba.length; for(int i = 0; i References: <001101c59c50$9a62cc50$2b001eac@aries> Message-ID: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Did I fix it? -J. From tjarvi at qbang.org Fri Sep 9 14:13:40 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:13:40 -0600 (MDT) Subject: [Rxtx] test post Message-ID: fixing mail-list problems. From tjarvi at qbang.org Fri Sep 9 14:37:46 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:37:46 -0600 (MDT) Subject: [Rxtx] Another Test Message-ID: We are trying to fix mail-list issues. From tjarvi at qbang.org Fri Sep 9 14:41:36 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 14:41:36 -0600 (MDT) Subject: [Rxtx] Yet Another test Message-ID: We are fixing mailman issues. From lavelle at cs.umn.edu Fri Sep 9 15:24:55 2005 From: lavelle at cs.umn.edu (Shawn Lavelle) Date: Fri, 09 Sep 2005 16:24:55 -0500 Subject: [Rxtx] Yet Another test In-Reply-To: References: Message-ID: <4321FDA7.50008@cs.umn.edu> Sweet! Yay for the mailing list being back! ~ Shawn Trent Jarvi wrote: > > We are fixing mailman issues. > _______________________________________________ > Rxtx mailing list > Rxtx at mail.electronpusher.org > http://www.electronpusher.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Sep 9 15:33:30 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 15:33:30 -0600 (MDT) Subject: [Rxtx] Does it work? In-Reply-To: <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> References: <001101c59c50$9a62cc50$2b001eac@aries> <0cb954b742c541a1670f0c97e704b2e4@electronpusher.org> Message-ID: On Thu, 8 Sep 2005, Jasmine Strong wrote: > Did I fix it? > > -J. > Looks like the list is working now. Thanks! From philippe.barthelemy at gmail.com Fri Sep 9 17:45:17 2005 From: philippe.barthelemy at gmail.com (Philippe BARTHELEMY) Date: Sat, 10 Sep 2005 01:45:17 +0200 Subject: [Rxtx] n00bie : looking for a simple Swing example Message-ID: Hi, I must admit I am a rookie Java developper... I am trying to get rxtx.org with a Swing app, and I a bit lost in the threading thing.... Does anyone have a simple example ? I do use a SwingWorker and an other thread for the rxtx event... I guess my synchronized routinr are just baaaad... ( I use java .4, not 1.5 and its reentrantlock... ) TIA, --P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050910/6e0e5f4e/attachment-0393.html From tjarvi at qbang.org Fri Sep 9 19:43:22 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 9 Sep 2005 19:43:22 -0600 (MDT) Subject: [Rxtx] n00bie : looking for a simple Swing example In-Reply-To: References: Message-ID: On Sat, 10 Sep 2005, Philippe BARTHELEMY wrote: > Hi, > > I must admit I am a rookie Java developper... > I am trying to get rxtx.org with a Swing app, and I a bit > lost in the threading thing.... > > Does anyone have a simple example ? > > I do use a SwingWorker and an other thread for the rxtx event... I guess my > synchronized routinr are just baaaad... > ( I use java .4, not 1.5 and its reentrantlock... ) > I've not seen a simple example with code using modern GUI libraries. The Sun examples are AWT based. If you get something together, I'd be glad to put it in the contrib directory. The blackbox and other examples that come with Sun's CommAPI may give you some ideas. Another interesting simple application would be the same idea using the SWT. http://www.eclipse.org/swt/ This comes with source and could be used to compile native applications with gcj http://gcc.gnu.org/java/ . I've been thinking about tossing together a blackbox like application using SWT. From lyon at docjava.com Sat Sep 10 03:22:47 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 10 Sep 2005 05:22:47 -0400 Subject: [Rxtx] rxtx - stopped working In-Reply-To: <20050808101048.A932A29C00C@mail.electronpusher.org> References: <20050808101048.A932A29C00C@mail.electronpusher.org> Message-ID: Hi All, I was using RXTX to drive the USB-Serial port systems for about a month. All worked well. Then, I disconnected the system, reconnected it and rebooted. Now it is not working. I get: Devel Library ========================================= Native lib Version = R-testing-XTX-2.1-7pre20noLock Java lib Version = R-testing-XTX-2.1-7pre20noLock trying to open:/dev/tty.modem On macos x 10.3.9. Any ideas what might be wrong here? How can I determine if the problem is hardware, or software? Thanks! - Doug